package com.gengzp.mq.server.model.generic;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * @ClassName MqPaginationResult
 * @Description mq内置分页查询返回实体类
 * @Author gengzp
 * @Date 2025/9/1 15:15
 */
public class MqPaginationResult<T> implements Serializable {

    @Serial
    private static final long serialVersionUID = 1573024188114126745L;

    /**
     * 页码
     */
    private int pageNum;

    /**
     * 每页数据条数
     */
    private int pageSize;

    /**
     * 数据总数
     */
    private int total;

    /**
     * 查询结果
     */
    private List<T> records;

    private MqPaginationResult() {
    }

    public static <T> MqPaginationResult<T> get(int pageNum, int pageSize, int total, List<T> records) {
        MqPaginationResult<T> mqPaginationResult = new MqPaginationResult<>();
        mqPaginationResult.setPageNum(pageNum);
        mqPaginationResult.setPageSize(pageSize);
        mqPaginationResult.setTotal(total);
        mqPaginationResult.setRecords(records);
        return mqPaginationResult;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }

}
